package com.easyban.controller;

import com.easyban.Dto.SessionWebUserDto;
import com.easyban.Dto.UserSpaceDto;
import com.easyban.annotation.GlobalInterceptor;
import com.easyban.constants.Constants;
import com.easyban.entity.vo.ResponseVO;
import com.easyban.utils.RedisUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@RestController
public class SpaceContoller extends ABaseController  {
    @Resource
    private RedisUtils redisUtils;
    @RequestMapping("/getUseSpace")
    @GlobalInterceptor(checkLogin = true)
    public ResponseVO gg(HttpSession session){
        SessionWebUserDto sessionAttribute = (SessionWebUserDto)session.getAttribute(Constants.SESSION_KEY);
        System.out.println(Constants.READIS_SPACE+sessionAttribute.getUserId());
        UserSpaceDto value = (UserSpaceDto)redisUtils.getValue(Constants.READIS_SPACE+sessionAttribute.getUserId());
        System.out.println(value.toString());
        return getSuccessResponseVO(value);
    }

}
